var t = getApp();

Page({
    data: {
        tapSelect: 0,
        active: "0",
        page: 1,
        current_page: 1,
        last_page: 1,
        isLoadMore: !0
    },
    init: function() {
        this.setData({
            page: 1,
            current_page: 1,
            last_page: 1,
            isLoadMore: !0
        });
    },
    onLoad: function(t) {
        wx.setNavigationBarTitle({
            title: "奖金池奖励"
        });
        var a = wx.getStorageSync("langIndex"), e = wx.getStorageSync("yz_basic_info");
        this.setData({
            language: a.en,
            love: e.love
        }), this.init(), this.getData();
    },
    toTeam: function() {
        wx.navigateTo({
            url: "/packageF/bonusPoolsIndex/bonusPoolsTeam/bonusPoolsTeam"
        });
    },
    bindChange: function(t) {
        var a = t.detail.index;
        this.setData({
            tapSelect: 0,
            active: a
        }), this.init(), this.getData();
    },
    tapSelectInd: function(t) {
        var a = t.currentTarget.dataset.ind;
        this.setData({
            tapSelect: a
        }), this.init(), this.getData();
    },
    getData: function() {
        var a = this, e = {
            page: this.data.page,
            award_type: this.data.active,
            award_status: 2 == this.data.tapSelect ? "-1" : 0 == this.data.tapSelect ? "0" : "1"
        }, n = t.getNetAddresss("plugin.xzhh-bonus-pool.frontend.controllers.center.index");
        t._getNetWork({
            url: n,
            data: e,
            success: function(t) {
                var e = t.data;
                1 == e.result ? a.setData({
                    info: e.data.info,
                    list: e.data.list.data,
                    current_page: e.data.list.current_page,
                    last_page: e.data.list.last_page
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMore: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.current_page >= this.data.last_page)) {
            var e = {
                award_type: this.data.active,
                award_status: 2 == this.data.tapSelect ? "-1" : 0 == this.data.tapSelect ? "0" : "1",
                page: this.data.page + 1
            }, n = t.getNetAddresss("plugin.xzhh-bonus-pool.frontend.controllers.center.index");
            t._getNetWork({
                url: n,
                data: e,
                success: function(t) {
                    a.data.isLoadMore = !0;
                    var e = t.data;
                    1 == e.result ? a.setData({
                        page: a.data.page + 1,
                        list: a.data.list.concat(e.data.list.data),
                        current_page: e.data.list.current_page,
                        last_page: e.data.list.last_page
                    }) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    this.data.isLoadMore = !0, console.log(t);
                }
            });
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore && this.getMore();
    },
    onShareAppMessage: function() {}
});